package com.niit.crud.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.niit.crud.bean.Department;
import com.niit.crud.bean.MSG;
import com.niit.crud.service.DepartmentService;

@Controller
public class DepartmentController {
	
	@Autowired
	private DepartmentService departmentService;
	
	@RequestMapping("/depts")
	@ResponseBody
	public MSG getDepts() {
		
		List<Department> list=departmentService.getDepts();
		
		return MSG.success().add("list", list);
	}
}